﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThucThe;
using System.Data;

namespace KetNoi
{
    public class KhachSan_ketnoi
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable danhSachKhachSan()
        {
            return kn.LayDuLieu("KhachSan_load");
        }
        public int Them_KhachSan(KhachSan_thucthe ks)
        {
            int Nparameter = 5;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenKhachSan"; value[0] = ks.TenKhachSan;
            name[1] = "@diaChi"; value[1] = ks.DiaChi;
            name[2] = "@email"; value[2] = ks.Email;
            name[3] = "@sdt"; value[3] = ks.Sdt;
            name[4] = "@moTa"; value[4] = ks.MoTa;
            return kn.CapNhat("KhachSan_them", name, value, Nparameter);
        }
        public int Sua_KhachSan(KhachSan_thucthe ks)
        {
            int Nparameter = 6;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maKhachSan"; value[0] = ks.MaKhachSan;
            name[1] = "@tenKhachSan"; value[1] = ks.TenKhachSan;
            name[2] = "@diaChi"; value[2] = ks.DiaChi;
            name[3] = "@email"; value[3] = ks.Email;
            name[4] = "@sdt"; value[4] = ks.Sdt;
            name[5] = "@moTa"; value[5] = ks.MoTa;
            return kn.CapNhat("KhachSan_sua", name, value, Nparameter);
        }
        public int Xoa_KhachSan(KhachSan_thucthe ks)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maKhachSan";
            value[0] = ks.MaKhachSan;
            return kn.CapNhat("KhachSan_xoa", name, value, Nparameter);
        }
        public DataTable Tim_KhachSan(KhachSan_thucthe ks)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenKhachSan";
            value[0] = ks.TenKhachSan;
            return kn.TimKiem("KhachSan_tim", name, value, Nparameter);
        }
    }
}
